package com.ruoyi.product.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.product.domain.dto.WoSubRawDto;
import com.ruoyi.product.service.WoSubRawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/woRawRel")
public class WoSubRawController {

    @Autowired
    WoSubRawService woSubRawService;

    /**
     * 开工接口(涂布)
     * @param woSubRawDto
     * @return
     */
    @PostMapping("/addWoRawRel")
    public R addTest(@RequestBody WoSubRawDto woSubRawDto){
        woSubRawService.addWoSubRaw(woSubRawDto);
        return R.ok("更新成功");
    }

    /**
     * 开工接口(增加子卷)
     * @param woSubRawDto
     * @return
     */
    @PostMapping("/startWoRaw")
    public R startWoRaw(@RequestBody WoSubRawDto woSubRawDto){
        woSubRawService.startWoRaw(woSubRawDto);
        return R.ok("更新成功");
    }

    /**
     * 暂停修改
     * @param woSubRawDto
     * @return
     */
    @PostMapping("/pauseWoRaw")
    public R pauseWoRaw(@RequestBody WoSubRawDto woSubRawDto){
        woSubRawService.pauseWoRaw(woSubRawDto);
        return R.ok("更新成功");
    }



    @PostMapping("/insertWoRawRel")
    public R insertWoRawRel(@RequestBody WoSubRawDto woSubRawDto){
        woSubRawService.insertWoRawRel(woSubRawDto);
        return R.ok("更新成功");
    }


    @PostMapping("/insertWoRawRels")
    public R insertWoRawRel(@RequestBody List<WoSubRawDto> woSubRawDtos){
        woSubRawService.insertWoRawRels(woSubRawDtos);
        return R.ok("更新成功");
    }
    @PostMapping("/endWoRaw")
    public R endWoRaw(@RequestBody WoSubRawDto woSubRawDto){
        woSubRawService.endWoRaw(woSubRawDto);
        return R.ok("更新成功");
    }
}
